﻿using SmartParkingClient.IDAL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SmartParkingClient.DAL
{
    public class FileDal : IFileDal
    {
        IWebDataAccess _webDataAccess;
        ILocalDataAccess _localDataAccess;
        public FileDal(IWebDataAccess webDataAccess, ILocalDataAccess localDataAccess)
        {
            _webDataAccess = webDataAccess;
            _localDataAccess = localDataAccess;
        }

        public async Task<DataTable> GetLocalFileList()
        {
            // EFCore  ：本地数据库（缓存-数据量少）
            //System.Text.Json.JsonSerializer.Serialize(new { "", "" });
            return _localDataAccess.GetFileList();
        }

        public Task<string> GetServerFileList()
        {
            return _webDataAccess.GetDatas("/api/File/list");
        }

        // 图片文本的读取   保存服务端    URL地址进行访问   
        // http://localhost:5000/api/file/1231231433432.jpg
        // http://localhost:5000/api/file/1231231433432.mp3
    }
}
